package com.nginx.web.controller;

import com.nginx.web.service.impl.ConfFileServiceImpl;
import com.nginx.web.service.impl.ConfigServiceImpl;
import com.nginx.web.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "配置管理")
@RequestMapping("/config")
@RestController
public class ConfigController {

    @Autowired
    private ConfigServiceImpl configService;


    @PostMapping("/saveConfig")
    @ApiOperation(value="保存配置")
    public Result saveConfig(@RequestParam(required = false)  Map<String,String> map){
        configService.saveConfig(map);
        return Result.success();
    }

    @PostMapping("/getConfigList")
    @ApiOperation(value="查询配置")
    public Result getConfigList(){
        Map<String,String> map = configService.getConfigList();
        return Result.success(map);
    }



}
